Mike Davidson, of Mike Industries (and CEO of NewsVine), has done some research into whether invalid code, nested tables and some other HTML factors can affect rankings at the search engines. My favorite bit:
So can invalid code get you penalized on search engines?
The answer: Yes, to a draconian degree, in fact….…What’s really interesting to me is that Google is doing one of two things (or both):
1. Somehow grading pages based on how they are rendered as well as how they are coded.
2. Simply counting the rest of the page as an attribute of the invalid table because the attribute is never officially closed off with an end quote.
There may also be other explanations to why this is happening, but this was the most interesting test in the bunch for me.
Conclusion: It’s not clear that validity helps search engine ranking, but it’s definitely true that certain errors in your code can get you completely removed from indexes.
Take a peek at the three test pages and his results – 3a, 3b and 3c. My problem with this is that he’s speculating that Google will damage all nonvalid code, when in fact, they’re simply only indexing the visible content on those pages. If they were to show the invalid pieces of code (that won’t display in the browser), that would be akin to cloaking.
The rest of his research is less interesting, IMO, but I’d love to hear a take on your opinions about the code issue.